import React,{Component} from 'react'
class CarouselItem extends Component{
    constructor(props) {
        super(props)
    
        this.state = {
          imgHeight: 176,
        }
    
    }
    render(){
        return (
            <a
              key={this.props.text}
              href="javascript:void(0);"
              style={{ display: 'inline-block', width: '100%', height: this.state.imgHeight }}
            >
              <img
                src={require(`../../assets/images/home/${this.props.text}.jpg`)}
                alt=""
                style={{ width: '100%', verticalAlign: 'top' }}
                onLoad={() => {
                  // fire window resize event to change height
                  window.dispatchEvent(new Event('resize'));
                  this.setState({ imgHeight: 'auto' });
                }}
              />
            </a>
        )
    }
}

export default CarouselItem